package cur.nature.framework.mvc.crud;

import cur.nature.framework.mvc.base.BaseService;
import cur.nature.framework.mvc.base.BasePO;
import cur.nature.framework.mvc.base.BaseVO;
import cur.nature.tinyorm.core.template.DefaultJdbcTemplate;
import org.springframework.jdbc.core.JdbcTemplate;

import java.util.List;

public abstract class CrudService<P extends BasePO, V extends BaseVO, D extends CrudDao>  implements BaseService {
    private D baseDao;
    public CrudService(D baseDao, Class<P> poClass, Class<V> voClass) {
//        super(poClass, voClass, baseDao.getTemplate());
        this.baseDao = baseDao;
    }
    protected D getDao() {
        return baseDao;
    }

    public DefaultJdbcTemplate getTemplate() {
        return baseDao.getTemplate();
    }

    public int save(V vo) throws Exception {
        return baseDao.save(vo);
    }

    public int saveList(List<V> list) throws Exception {
        return baseDao.saveList(list);
    }


}
